package models

import (
	"time"

	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	UserName  string         `gorm:"unique;not null comment:用户名" json:"user_name"`
	Password  string         `gorm:"not null comment:密码" json:"password"`
	Email     string         `gorm:"unique;not null comment:邮箱" json:"email"`
	Phone     string         `gorm:"unique;not null comment:手机号" json:"phone"`
	CreatedAt time.Time      `gorm:"not null comment:创建时间" json:"created_at"`
	UpdatedAt time.Time      `gorm:"not null comment:更新时间" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"default null comment:删除时间" json:"deleted_at"`
}

type DymamicIP struct {
	gorm.Model
	IP        string         `gorm:"not null comment:IP" json:"ip"`
	Type      string         `gorm:"not null comment:类型" json:"type"`
	Url       string         `gorm:"not null comment:URL" json:"url"`
	Port      string         `gorm:"not null default:80 comment: 端口" json:"port"`
	Protocal  string         `gorm:"not null default:http comment:协议" json:"protocal"`
	UserID    uint           `gorm:"not null comment:用户ID" json:"user_id"`
	User      User           `gorm:"foreignKey:UserID;references:ID"`
	CreatedAt time.Time      `gorm:"not null comment:创建时间" json:"created_at"`
	UpdatedAt time.Time      `gorm:"not null comment:更新时间" json:"updated_at"`
	DeletedAt gorm.DeletedAt `gorm:"default null comment:删除时间" json:"deleted_at"`
}
